# this is a NodeBox script (nodebox.net)
# and needs the Nodebox Graph library (http://nodebox.net/code/index.php/Graph) to live.
# if you don't have a Mac (NodeBox is Mac only), check out some sample output:
# http://thinking-chair.com/notebook/2008/05/24/photo.205/

graph = ximport('graph')
import xmlrpclib

size(640,480)

s = xmlrpclib.Server('http://mac-mini.local/braindump/svn/trunk/xmlrpc.php')
g = graph.create(iterations=7000)

for page in s.graph.list():
    g.add_node(page)
    data = s.graph.get(page)
    for attribute in data:
        value = data[attribute]
        if(isinstance(value,list)):
            g.add_node(attribute,style='marked')
            g.add_edge(page,attribute)
            for item in value:
                g.add_node(item)
                g.add_edge(attribute,item)
        else:
            g.add_edge(page,data[attribute],label=attribute)

g.prune()
g.solve()
g.draw(directed=True)
